//
//  TweetAPITools.m
//  OSChina
//
//  Created by 8b410-2 on 16/12/25.
//  Copyright © 2016年 abb. All rights reserved.
//

#import "OSCTweetTools.h"
#import "OSCNetAPIClient.h"
@implementation OSCTweetTools

+ (RACSignal *)requestTweetListWithParamsModel:(OSCTweetListRequestParams *)params {
    return [[[OSCNetAPIClient shareJsonClient]
            requestJsonDataWithPath:tweet_list
            Params:[params mj_keyValues]]
            map:^id(NSDictionary *dict) {
                // 拿到模型字典
                NSArray *modelsDict = [dict valueForKey:@"tweetlist"];
                // 转模型
                return [OSCTweet mj_objectArrayWithKeyValuesArray:modelsDict];
            }];
}

+ (RACSignal *)requestTweetPubWithParamsModel:(OSCTweetPubRequestParams *)params {
    NSDictionary *paramsDict = [params mj_keyValuesWithIgnoredKeys:@[NSStringFromSelector(@selector(imagesData))]];
    NSArray *datas = params.imagesData;
    return [[OSCNetAPIClient shareJsonClient]
            requestUpdateWithPath:tweet_pub
            Params:paramsDict Datas:datas DataName:@"img" mimeType:@"image/png"];
    
}
@end
